package com.qyhl.webtv.module_microvideo.shortvideo.user;


import com.qyhl.webtv.basiclib.utils.network.EasyHttp;
import com.qyhl.webtv.basiclib.utils.network.callback.SimpleCallBack;
import com.qyhl.webtv.basiclib.utils.network.exception.ApiException;
import com.qyhl.webtv.commonlib.entity.microvideo.ShortVideoUserBean;
import com.qyhl.webtv.module_microvideo.common.VideoUrl;

public class ShortVideoUserCenterModel implements ShortVideoUserCenterContract.ShortVideoUserCenterModel {
    private ShortVideoUserCenterPresenter mPresenter;

    ShortVideoUserCenterModel(ShortVideoUserCenterPresenter mPresenter) {
        this.mPresenter = mPresenter;
    }

    @Override
    public void getUserInfo(String phone) {
        EasyHttp.get(VideoUrl.GET_SHORT_VIDEO_USER_INFO)
                .params("phone", phone)
                .execute(new SimpleCallBack<ShortVideoUserBean>() {
                    @Override
                    public void onError(ApiException e) {
                        mPresenter.setUserError("获取失败，点击头像重新获取！");
                    }

                    @Override
                    public void onSuccess(ShortVideoUserBean shortVideoUserBean) {
                        mPresenter.setUserInfo(shortVideoUserBean);
                    }
                });
        
    }
}
